﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	x:Class="Faust.Andrew.MTG.Player.AddTokenWindow"
	x:Name="Window"
	Title="Add Creature Token"
	Width="640" Height="397" mc:Ignorable="d" Background="{DynamicResource WindowBackground}" ResizeMode="CanResizeWithGrip" Icon="MTGManagerIcon.ico">
	<Window.Resources>
		<ItemsPanelTemplate x:Key="CardImageItemPanel">
			<WrapPanel IsItemsHost="True"/>
		</ItemsPanelTemplate>
		<DataTemplate x:Key="CardImageItemTemplate">
			<Grid>
				<Image Source="{Binding Value, Mode=OneWay}" Stretch="None"/>
			</Grid>
		</DataTemplate>
		<Style x:Key="TokenItemContainer" TargetType="{x:Type ListBoxItem}">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
			<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
			<Setter Property="Padding" Value="2,0,0,0"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ListBoxItem}">
						<Border x:Name="Bd" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="0,0,5,5" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="5">
							<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsSelected" Value="true">
								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
							</Trigger>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="true"/>
									<Condition Property="Selector.IsSelectionActive" Value="false"/>
								</MultiTrigger.Conditions>
								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
							</MultiTrigger>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</Window.Resources>

	<DockPanel x:Name="LayoutRoot" Background="{DynamicResource WindowBackground}" Margin="5">
		<StackPanel VerticalAlignment="Top" Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right" Margin="0,5,0,0">
			<Button x:Name="btnCancel" Margin="0,0,10,0" Width="50" Content="Cancel" Click="btnCancel_Click"/>
			<Button x:Name="btnOK" Width="50" Content="OK" Click="btnOK_Click"/>
		</StackPanel>
		<TextBox x:Name="txtModifierText" VerticalAlignment="Top" Text="1/1 Creature Token" TextWrapping="Wrap" DockPanel.Dock="Bottom" Margin="0,5,0,0" Background="#7FFFFFFF"/>
		<ListBox x:Name="lbCardImages" Margin="0" MinHeight="300" d:LayoutOverrides="Height" DockPanel.Dock="Top" ItemsPanel="{DynamicResource CardImageItemPanel}" ItemTemplate="{DynamicResource CardImageItemTemplate}" ItemsSource="{Binding Presenter.Model.TokenImages, ElementName=Window, Mode=Default}" Background="#7EFFFFFF" ItemContainerStyle="{DynamicResource TokenItemContainer}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto" BorderThickness="1,1,5,1" />		
	</DockPanel>
</Window>